package com.example.controller;

import com.example.framwork.exception.BusinessLogicException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

@RestController
@Slf4j
public class ErrorController {

    @Resource
    private HttpServletRequest request;

    @RequestMapping("/errorInter")
    public void errorInter() {
        log.info("error errorInter");
        String errorInfo = request.getAttribute("errorMsg").toString();
        throw new BusinessLogicException(errorInfo);
    }

}
